/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package taikai;

import taikai.draws.DrawStrategy;
import java.io.Serializable;

/**
 *
 * @author jeffmartin
 */
public class Data implements Serializable {

    private final PeopleData players = new PeopleData();
    private final MatchesData matches = new MatchesData();
    private final Teams teams = new Teams();
    private boolean teamEvent;

    public PeopleData getPlayers() {
        return players;
    }

    public MatchesData getMatches() {
        return matches;
    }

    public Teams getTeams() {
        return teams;
    }

    void createTeam(int[] selection, String name) {
        Team team = new Team(name);
        for(int i:selection) {
            team.add(players.getPerson(i));
        }
        teams.add(team);
    }

    void generateMatches(DrawStrategy strategy, boolean teamEvent) {
        strategy.generateMatches(matches);
    }

    TeamsOrPlayers getTeamsOrPlayers() {
        return teamEvent?teams:players;
    }

    void setTeamEvent(boolean teamEvent) {
        this.teamEvent = teamEvent;
    }
}
